home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 685 < prev    next >
Text File  |  1996-08-06  |  1KB  |  29 lines

  1. Path: cnn.Princeton.EDU!franck!tim
  2. From: tim@franck (Tim Hollebeek)
  3. Newsgroups: comp.std.c
  4. Subject: Initializing a variable in terms of itself
  5. Date: 1 Apr 1996 21:53:57 GMT
  6. Organization: Princeton University
  7. Message-ID: <4jpj9l$ik9@cnn.Princeton.EDU>
  8. Reply-To: tim@wfn-shop.princeton.edu
  9. NNTP-Posting-Host: franck.princeton.edu
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Just out of curiosity, is this legal?
  13.  
  14. int main() {
  15.     int x = x;
  16.     return 0;
  17. }
  18.  
  19. gcc compiles it without even a warning, suprisingly.  I had a slightly
  20. more complex version of the same thing which was part of a bug in
  21. another program, and would like to have known about it (the second x
  22. was a typo).
  23.  
  24. ---------------------------------------------------------------------------
  25. Tim Hollebeek         | Disclaimer :=> Everything above is a true statement,
  26. Electron Psychologist |                for sufficiently false values of true.
  27. Princeton University  | email: tim@wfn-shop.princeton.edu
  28. ----------------------| http://wfn-shop.princeton.edu/~tim (NEW! IMPROVED!)
  29.